<?php
/**********************************************************************//**\file
	Armory XML

	Description: Provides a simplified interface with which to parse
		wowarmory.com XML files.
*******************************************************************************/

	class armoryxml
	{
		# create the standard php xml data object and attach it to the cached
		# version of the data (database), then pass it off to the appropriate
		# specialized class for processing

		# since this will be invoked by the other specialized classes, this one
		# simply provides access to the common XML components and automates the
		# like aspects of those classes

		protected $xmldata;

		# get xml data from cache
		protected function get_cache($type, $name)
		{
			$this->xmldata = new DOMDocument();

			GLOBAL $config;

			if($config['cache_method'] == 'filesystem')
			{
				$this->xmldata->loadXML(file_get_contents(dirname(__FILE__).'/../'.$config['cache_folder'].'/'.$type.'/'.$name.'.xml'));
			}
			elseif($config['cache_method'] == 'database')
			{
				$db = new armorydb();
				$db->query("SELECT cache_data FROM armory_cache WHERE cache_type = '$type' AND cache_name = '$name'");
				$xml = $db->quick_result();

				$this->xmldata->loadXML($xml);

				unset($db);
			}
		}
	}
?>
